package sys.controller;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import sys.entity.Student;
import sys.entity.Teacher;
import sys.service.StudentService;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("stu")
public class StuController {

    @Autowired
    private StudentService studentService;

    @RequestMapping("findPages")
    public PageInfo findPage(Integer pageIndex, @RequestBody Map serachMap) {
        return studentService.findPage(pageIndex, serachMap);
    }

    @RequestMapping("findTea")
    public List<Teacher> findTea() {
        return studentService.findTea();
    }

    @RequestMapping("addD")
    public void addD(Integer[] checkitemIds, @RequestBody Student student) {
        studentService.addD(checkitemIds, student);
    }

    @RequestMapping("findById")
    public Student findById(Integer id) {
        return studentService.findById(id);
    }

    @RequestMapping("editStu")
    public void editStu(Integer[] checkitemIds, @RequestBody Student student) {
        studentService.editStu(checkitemIds, student);
    }

    @RequestMapping("findTidBySid")
    public List<Integer> findTidBySid(Integer id) {
        return studentService.findTidBySid(id);
    }
}
